//
//  ShipingListTableViewCell.m
//  B段项目
//
//  Created by 徐茂怀 on 15/11/3.
//  Copyright © 2015年 徐茂怀. All rights reserved.
//

#import "ShipingListTableViewCell.h"
#import "FitHeader.h"
#import "UIImageView+WebCache.h"
@implementation ShipingListTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}

-(void)createView
{
    _myImageView = [[UIImageView alloc]init];
    _titleLabel = [[UILabel alloc]init];
    _titleLabel.font = [UIFont fontWithName:@"EuphemiaUCAS-Bold" size:25 * FitWidth];
    _bofangLabel = [[UILabel alloc]init];
    _bofangLabel.font = [UIFont fontWithName:@"Helvetica-LightOblique" size:15 * FitWidth];
    _peiLiaoLabel = [[UILabel alloc]init];
    _peiLiaoLabel.font = [UIFont fontWithName:@"Helvetica-LightOblique" size:15 * FitWidth];
    _button = [UIButton buttonWithType:UIButtonTypeSystem];
    [_button setImage:[UIImage imageNamed:@"iconfont-shipinrenzheng (1).png"] forState:0];
    _button.tintColor = [UIColor whiteColor];
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    [self.contentView addSubview:_myImageView];
    [self.contentView addSubview:_titleLabel];
    [self.contentView addSubview:_bofangLabel];
    [self.contentView addSubview:_peiLiaoLabel];
    [self.myImageView addSubview:_button];
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    _myImageView.frame = CGRectMake(10 * FitWidth, 10 * FitHeight, 120 * FitWidth, 80 * FitHeight);
    _titleLabel.frame = CGRectMake(_myImageView.frame.origin.x + _myImageView.frame.size.width + 10 * FitWidth, 14 * FitHeight, 200 * FitWidth, 25 * FitHeight);
    _bofangLabel.frame = CGRectMake(_titleLabel.frame.origin.x, _titleLabel.frame.origin.y + _titleLabel.frame.size.height + 8 * FitHeight, 200 * FitWidth, 15 * FitHeight);
    _peiLiaoLabel.frame = CGRectMake(_titleLabel.frame.origin.x, _bofangLabel.frame.origin.y + _bofangLabel.frame.size.height + 8 * FitHeight, 200 * FitWidth, 15 * FitHeight);
    _button.frame = CGRectMake(90 * FitWidth, 10 * FitHeight, 25 * FitWidth, 25 * FitHeight);
}

-(void)setModel:(ShipingModel *)model
{
    [_myImageView sd_setImageWithURL:[NSURL URLWithString:model.Cover]];
    _titleLabel.text = model.Title;
    _bofangLabel.text = model.Collection;
    _peiLiaoLabel.text = model.Stuff;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
